<div class="container">
  <h1>get_where_in()</h1>
  <p class="signature">public function get_where_in(string $column, array $values, ?string $target_table = null, string $return_type = 'object'): array</p>
  <h2>Description</h2>
  <div class="description">
    <p>
      Retrieves records from a database table where the column's value is within a specified array of values. This method allows for filtering records based on multiple values for a given column.
    </p>
  </div>
  <h2>Parameters</h2>
  <table>
    <thead>
      <tr>
        <th>Parameter</th>
        <th>Type</th>
        <th>Description</th>
        <th>Default</th>
        <th>Required</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>$column</td>
        <td>string</td>
        <td>The name of the column to filter by.</td>
        <td>N/A</td>
        <td>Yes</td>
      </tr>
      <tr>
        <td>$values</td>
        <td>array</td>
        <td>The array of values to match against the specified column.</td>
        <td>N/A</td>
        <td>Yes</td>
      </tr>
      <tr>
        <td>$target_table</td>
        <td>string|null</td>
        <td>The name of the database table to be queried. Default is 'First URL segment'.</td>
        <td>'First URL segment'</td>
        <td>No</td>
      </tr>
      <tr>
        <td>$return_type</td>
        <td>string</td>
        <td>The type of result to return ('object' or 'array').</td>
        <td>object</td>
        <td>No</td>
      </tr>
    </tbody>
  </table>
  <h2>Return Value</h2>
  <table>
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>array</td>
        <td>Returns an array of objects or arrays representing the fetched rows.</td>
      </tr>
    </tbody>
  </table>
  <h2>Example #1</h2>
  <p>The following code sample demonstrates how to fetch an array of records from a 'members' table where the 'id' values match those within a specified array of integers. In this example, the table name is not explicitly passed as an argument, so the method will derive the table name from the first URL segment.</p>
  <div class="example">
    <pre><code>// Assuming the URL is: http://your-domain.com/members/{method_name}
$member_ids = [1, 2, 3, 4];
$members = $this->model->get_where_in('id', $member_ids);
foreach ($members as $member) {
    echo $member->username.'<br>';
}
</code></pre>
  </div>
  <h2>Example #2</h2>
  <p>This example demonstrates explicitly passing the table name and specifying the return type for the records. This approach provides more control over the query execution and result format.</p>
  <div class="example">
    <pre><code>$column = 'id';
$values = [1, 2, 3, 4];
$target_table = 'items';
$return_type = 'object';

$items = $this->model->get_where_in($column, $values, $target_table, $return_type);
foreach ($items as $item) {
    echo $item->title;
}
</code></pre>
  </div>
</div>
